<template>
    <div class='body'>
        <div class="main">
            <div class="top">
            </div>
            <div class="bom">

                <el-table :data="tableData" stripe style="width: 50%">
                    <el-table-column prop="userId" label="userId" width="180" />
                    <el-table-column prop="name" label="Name" width="180" />
                    <el-table-column prop="loginTime" label="loginTime" />
                </el-table>

            </div>
        </div>
    </div>
</template>
<script setup lang='ts'>
import { infodata, toudata } from '@/api/info/index'
import moment from 'moment';
let tableData = ref()
let imgs = ref()
onMounted(() => {
    infodata().then((res: any) => {
        console.log('日志', res)
        res.data.forEach((item: any) => {
            item.loginTime = moment(item.loginTime).format('YYYY-MM-DD HH:mm:ss'); // 格式化为"年-月-日 时:分:秒"
        });
        tableData.value = res.data.reverse()
    })

    // 获取当前时间
    // const loginTime1 = new Date();
    // let aaa = moment(loginTime1).format('YYYY-MM-DD HH:mm:ss');
    // console.log("aaaa", aaa);


    // 测试base64存储
    toudata().then((res: any) => {
        console.log("imgs", res);
        imgs.value = res.data[0].tou

    })
})
</script>
<style  lang='less'>
.body {
    background-color: rgb(245, 249, 250);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-evenly;

    .main {
        width: 80%;
        height: 95%;
        // background-color: #fff;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;

        .top {
            width: 100%;
            height: 10%;
            background-color: #fff;
            box-sizing: border-box;
            padding: 10px 0px 10px 25px;
            display: flex;
            align-items: center;
        }

        .bom {
            width: 100%;
            height: 89%;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            background-color: #fff;
            box-sizing: border-box;
            padding-top: 25px;
            padding-left: 10px;
        }
    }
}
</style>